﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BattleFury.Lib.Lights
{
	public class Light
	{
		public Vector2 Position { get; set; }
		public float Range { get; set; }
		public Color Color { get; set; }
		public Texture2D Texture { get; set; }
		public Vector2 Center { get; set; }
		public float Scale { get; set; }
		public Vector2 Offset { get; set; }

		public Light(Texture2D texture, Color color, float range, Vector2 position)
		{
			Texture = texture;
			Color = color;
			Range = range;
			Position = position;
			Center = new Vector2(Texture.Width / 2, Texture.Height / 2);
			Scale = range / (Texture.Width / 2f);
			Offset = Vector2.Zero;
		}

		public void Draw(SpriteBatch spriteBatch)
		{
			spriteBatch.Draw(Texture, Position, null, Color, 0, Center - Offset, Scale, SpriteEffects.None, 1);
		}
	}
}